package com.wenlin.myproduction.ui;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.wenlin.myproduction.R;
import com.wenlin.myproduction.base.BaseActivity;
import com.wenlin.myproduction.base.BaseSwipeActivity;
import com.wenlin.myproduction.util.UI;
import com.wenlin.myproduction.util.ValCommon;
import com.wenlin.myproduction.widget.GoldView;

import butterknife.BindView;
import butterknife.OnClick;

public class GoldViewActivity extends BaseSwipeActivity {
    @BindView(R.id.gv)
    GoldView gv;

    @Override
    public int getContentView() {
        return R.layout.activity_gold_view;
    }

    public static void start(BaseActivity activity) {
        Intent intent = new Intent(activity, GoldViewActivity.class);
        activity.startActivity(intent);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setTitle(ValCommon.GOLD_VIEW);
        UI.setGold(gv, 99, true);
    }

    @OnClick({R.id.tv_reset, R.id.tv_add, R.id.tv_reduce})
    void click(View view) {
        switch (view.getId()) {
            case R.id.tv_reset:
                UI.setGold(gv, 99, true);
                break;
            case R.id.tv_add:
                UI.setGold(gv, gv.getNumber() + 10, false);
                break;
            case R.id.tv_reduce:
                UI.setGold(gv, gv.getNumber() - 10, false);
                break;
            default:
        }
    }
}
